<?php use_helper('Form')?>
<h3>Lista de Sugerencias</h3>
<?php echo link_to(image_tag('icons/add2.png'),'sugerencia/create') ?>

<strong><?php echo $articuloList->getNbResults() ?></strong> Productos en el Inventario
<table class="lista">
<caption>
  <?php echo form_tag("sugerencia/index")?>
      Clave<?php echo input_tag("find")?>
      Nombre<?php echo input_tag("find2")?>
      Proveedor<?php echo input_tag("find3")?>
      Reorden?<?php echo checkbox_tag("find4",'true')?>
      <?php echo  submit_tag("Buscar")?>
</caption>
  <thead>
  
    <tr>
      <th></th>
      <th></th>
      <th><?php echo link_to("Clave",'sugerencia/index?'.http_build_query($sf_request->extractParameters(array("page","find","find2","find3"))).
      '&sort='.ArticuloPeer::CODIGO)?></th>
      <th><?php echo link_to("Nombre",'sugerencia/index?'.http_build_query($sf_request->extractParameters(array("page","find","find2","find3"))).
      '&sort='.ArticuloPeer::NOMBRE)?></th>
      <th><?php echo link_to("Proveedor",'sugerencia/index?'.http_build_query($sf_request->extractParameters(array("page","find","find2","find3"))).
      '&sort='.ProveedorPeer::NOMBRE)?></th>
      <th>%Desc</th>            
      <th>Cant.</th>
      <th>Reorden?</th>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($articuloList->getResults() as $articulo): ?>
    <tr>
      <td><?php echo link_to(image_tag('icons/edit.png'),'sugerencia/edit?id='.$articulo->getId())?>Editar<br/>
      <td><?php echo image_tag('fotos/'.$articulo->getFoto(),array("width"=>"32") ) ?></td>
      <td><?php echo link_to($articulo->getCodigo(),'sugerencia/edit?id='.$articulo->getId()) ?></td>
      <td><?php echo $articulo->getNombre() ?></td>
      <td><?php echo $articulo->getProveedor()?></td>
      <td><?php echo $articulo->getDescuento() ?></td>
      <td><?php echo $articulo->getExistencia() ?></td>
      <td><?php echo $articulo->getReordenacion() ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
  <tfoot>
    <tr>
      <td colspan="5"><strong><?php echo $articuloList->getNbResults() ?></strong> Artículos</td>
      <td colspan="3">
        Página <?php if ( $articuloList->haveToPaginate() ): ?>
          <?php echo link_to('&laquo', 'sugerencia/index?'.http_build_query($sf_request->extractParameters(array("sort","find","find2","find3"))).'&page='.$articuloList->getFirstPage()) ?>
          <?php echo link_to('&lt;', 'sugerencia/index?'.http_build_query($sf_request->extractParameters(array("sort","find","find2","find3"))).'&page='.$articuloList->getPreviousPage()) ?>
          <?php $links = $articuloList->getLinks(); foreach ($links as $page): ?>
            <?php echo ($page == $articuloList->getPage()) ? $page : link_to($page, 'sugerencia/index?'.http_build_query($sf_request->extractParameters(array("sort","find","find2","find3"))).'&page='.$page) ?>
            <?php if ($page != $articuloList->getCurrentMaxLink()): ?> - <?php endif ?>
          <?php endforeach ?>
          <?php echo link_to('&gt;', 'sugerencia/index?'.http_build_query($sf_request->extractParameters(array("sort","find","find2","find3"))).'&page='.$articuloList->getNextPage()) ?>
          <?php echo link_to('&raquo;', 'sugerencia/index?'.http_build_query($sf_request->extractParameters(array("sort","find","find2","find3"))).'&page='.$articuloList->getLastPage()) ?>        
       <?  endif ?>
      </td>
    </tr>
  </tfoot>
</table>
